<div class="main-box-info tb-imte">
	<table class="mem-biao" id="teamlotteryReport">
		<thead>
			<tr>
				<th colspan="8"><span>时间：</span> <input
					class="layriqi starTime" type="text"
					onclick="laydate({format:'YYYY-MM-DD',isclear:false});"
					readonly="true"> <span class="zhi">至</span> <input
					class="layriqi endTime" type="text"
					onclick="laydate({format:'YYYY-MM-DD',isclear:false});"
					readonly="true"> 
				<span>用户类型：</span> <select id="userRelation">
						<option value="1">所有人</option>
						<option value="2">我自己</option>
						<option value="3">直属下线</option>
						<option value="4">所有下线</option>
				</select> 
				<span>彩种类型：</span> <select class="lottery">
				</select><a href="javascript:;" class="butsty1">查询</a></th>
			</tr>
		</thead>
	</table>
	<table class="mem-biao" style="width: 100%">
		<tbody>
			<tr>
				<th>序号</th>
				<th>游戏类别</th>
				<th>购买单数</th>
				<th>购买注数</th>
				<th>购买金额</th>
				<th>撤单金额</th>
				<th>中奖注数</th>
				<th>中奖奖金</th>
				<th>返点金额</th>
				<th>盈亏金额</th>
			</tr>
		</tbody>
		<tbody id="teamlotteryReport-data">
		</tbody>
	</table>
</div>

<script type="text/javascript">
	$(function() {
		$("#teamlotteryReport .starTime").val(laydate.now(-3));
		$("#teamlotteryReport .endTime").val(laydate.now(1)); 
		$("#teamlotteryReport .butsty1").livequery("click",teamLotteryReport);
		$("#teamlotteryReport .butsty1").trigger('click');
		$.ajax({
				url : "/sscList",
				method : 'GET',
				success : function(data) {
					if (data.retcode == 0) {
					   $("#teamlotteryReport .lottery").append(new Option("全部彩种",""));
					   for(var i=0;i<data.data.length;i++){
						   var lottery = data.data[i];
						   for(var j = 0 ;j <lottery.lotteryList.length;j++)
						   {
							   var op = new Option(lottery.lotteryList[j].lotteryName,lottery.lotteryList[j].id);
							   $("#teamlotteryReport .lottery").append(op);
						   }
					   }  
					} else {
						popTips(data.message, "error");
					}
				}
			});
	});
	
	//获取订单信息（不包括追号订单）
	function teamLotteryReport() {
		var starTime = $("#teamlotteryReport .starTime").val();
		var endTime = $("#teamlotteryReport .endTime").val();
		if (dateDiff(starTime, endTime) < 0) {
			popTips('查询结束日期要大于开始日期', 'error');
			return false;
		}  
		var pagination = $.pagination({
			render : '.paging',
			pageSize : 10,
			pageLength : 3,
			ajaxType : 'get',
			hideInfos : false,
			hideGo : true,
			ajaxUrl : '/bet/teamLotteryReport',
			ajaxData : { 
				"startDate" : starTime,
				"endDate" : endTime, 
				"lotteryId" :  $("#lotteryReport .lottery").val(), 
				"userRelation":$("#userRelation").val()
			//是否是追号 0不是追号 1追号
			},
			success : function(data) {
				$("#teamlotteryReport-data").html(
						_.template($('#teamlotteryReport_template').html(), {
							items : data
						}));
			}
		});
		pagination.init();
	}
</script>



<script type="text/html" id="teamlotteryReport_template"> 
<%_.each(items,function(item,index) {%>
       <tr style="border-right: 1px solid #ccc; border-left: 1px solid #ccc; cursor: pointer">
		<td><%=index+1 %></td>
		<td><%=item.lname %></td>
		<td><%=item.betsCount %></td>
		<td><%=item.betsNum %></td>
		<td><%=item.amount.toFixed(4) %></td>
        <td><%=item.cancelBetAmount.toFixed(4)%></td>
		<td><%=item.zjCount||0%></td>
		<td><%=item.bonus || 0.0 %></td>
		<td><%=item.fanDian || 0.0%></td>  
		<td> 
           <%=((item.bonus || 0.0) + (item.fanDian || 0.0) - item.amount).toFixed(4)%>
        </td> 
	</tr>    
<%})%>
</script>